home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
441
/
dlibs12
/
catch.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-23
|
382b
|
19 lines
#include <setjmp.h>
static int _catchval; /* catch/throw return value */
int catch(id, fn) /* execute fn() within a catch frame */
register jmp_buf *id;
register int (*fn)();
{
return(setjmp(id) ? _catchval : ((*fn)()));
}
throw(id, rv) /* return rv to the id catch */
register jmp_buf *id;
register int rv;
{
_catchval = rv;
longjmp(id, 1);
}